package com.zxl.collection;

import java.util.List;
import java.util.ArrayList;
import java.util.Collections;

/**
 * 和集合相关的测试类
 * @author zxl
 *
 */
public class CollectionsTest {
	
	/**
	 * 测试不可修改的集合
	 */
	public void testUnmodify() {
		List<String> list = new  ArrayList<String>();
		list.add("a");
		List<String> udl = Collections.unmodifiableList(list);
		udl.add("b");	//java.lang.UnsupportedOperationException
		System.out.println(udl.get(1));
	}
	
	public static void main(String[] args) {
		CollectionsTest ct = new CollectionsTest();
		ct.testUnmodify();
	}
}
